package com.qzq.weibo.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLiteHelper extends SQLiteOpenHelper {

	private static final String DB_NAME = "WeiCozzz.db";
	private static final String TABLE_NAME = "User";
	private static final int DB_VERSION = 1;
	
	public SQLiteHelper(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		
		String sql = "CREATE TABLE " + TABLE_NAME + "("
				+ " id INTEGER PRIMARY KEY AUTOINCREMENT, "
				+ " username VARCHAR(50)," + " password VARCHAR(50)" + ")";

		db.execSQL(sql);

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		
		String sql = "DROP TABLE IF EXISTS" + TABLE_NAME;
		db.execSQL(sql);
		this.onCreate(db);


	}

}
